// 用于判断店铺小程序 跳转到平台小程序
const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    url: {
      type: String,
      value: '',
      observer(path) {
        //单独处理商品 新商品跳转
        if (~path.indexOf('pages/TabBar/Goods/index') || ~path.indexOf('pages/TabBar/Goods/new') || ~path.indexOf('pages/TabBar/Class/index') || ~path.indexOf('pages/TabBar/Class/newIndex')) {
          this.setData({
            openType: 'reLaunch' //若tabbar没有配置商品列表，此处可改成 navigateTo
          });
        }
        let {
          authWechatId = ''
        } = this.data;
        if (authWechatId) {
          if (~path.indexOf('?')) {
            authWechatId = `&authWechatId=${authWechatId}`;
          } else {
            authWechatId = `?authWechatId=${authWechatId}`;
          }
        }
        this.setData({
          path: `${path}${authWechatId}`
        });
      }
    },
    authAppId: {
      //授权的appid
      type: String,
      value: ''
    },
    authWechatId: {
      //授权的appid
      type: String,
      value: ''
    }
  },
  data: {
    openType: 'navigate',
    path: ''
  }
});